package rabbitmq;

import com.rabbitmq.client.*;

import java.io.IOException;

public class Test2 {

    public static void main(String[] args) throws IOException {
        Connection connection = RabbitMQKit.getConnection();
        Channel channel = connection.createChannel();

        DefaultConsumer consumer = new DefaultConsumer(channel){
            @Override
            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
                String msg = new String(body, "utf-8");
                System.out.println("new api recv: "+msg);
            }
        };
        System.out.println("开始监听。。。。");
        channel.basicConsume("command.topic.queue", true, consumer);



        channel.close();
        connection.close();
    }
}
